import { Column, CreateDateColumn, Entity, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm';
import { dateTransformer } from '../../../../common/utils';

@Entity('session', {
  comment: '会话表，存储对话会话的基本信息',
})
export class SessionEntity {
  @PrimaryGeneratedColumn({ type: 'int', name: 'id', comment: '会话ID，用于关联同一场对话' })
  public id: number;

  @Column({ type: 'varchar', name: 'title', default: null, comment: '会话标题' })
  public title: string;

  @Column({ type: 'int', name: 'user_id', default: null, comment: '用户ID' })
  public userId: number;

  @Column({ type: 'char', name: 'del_flag', default: false, comment: '删除标志' })
  public delFlag: string;

  @CreateDateColumn({ type: 'datetime', name: 'create_time', default: null, transformer: dateTransformer, comment: '创建时间' })
  public createTime: Date;

  @UpdateDateColumn({ type: 'datetime', name: 'update_time', default: null, transformer: dateTransformer, comment: '更新时间' })
  public updateTime: Date;
}
